package com.example.demo.job;

import com.example.demo.service.JobService;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description 这里不需要使用@Component，
 * 因为SpringBeanJobFactory类会将SpringBeanJob任务类注入到IOC容器中
 * https://www.cnblogs.com/jason1990/archive/2019/06/30/11110196.html
 *
 * @Date 2021-01-13 5:04 下午
 * @Author wuyanshen
 */
public class SpringBeanJob implements Job {

    @Autowired
    private JobService jobService;

    @Override
    public void execute(JobExecutionContext context) {
        jobService.doJob(context.getJobDetail().getJobDataMap());
    }
}
